//
//  UIColor+Ex.swift
//  GhostWorld
//
//  Created by Kam on 2018/4/2.
//  Copyright © 2018 LKGood. All rights reserved.
//

import UIKit

extension UIColor {
  
  enum PresetColor {
    case globalTint, navTitleColor, navBarTint
  }
  
  convenience init(fromRGB rgbValue: UInt, alpha: Double = 1.0) {
    self.init(red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
              green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
              blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
              alpha: CGFloat(alpha)
    )
  }
  
  convenience init(fromPreeset: PresetColor) {
    switch fromPreeset {
    case .globalTint:
      self.init(fromRGB: 0xF20B1D)
    case .navTitleColor:
      self.init(fromRGB: 0xC3C3C3)
    case .navBarTint:
      self.init(fromRGB: 0x404040)
    }
  }
}
